﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CoreUtils.Common
{
    /// <summary>
    /// Ultis for folder and file
    /// </summary>
    public class FolderFile
    {
        /// <summary>
        /// Create a folder from current working folder and return full path
        /// </summary>
        /// <param name="folderName"></param>
        /// <returns>full path</returns>
        /// <remarks>trungpv@vnext.vn</remarks>
        public static string makeWorkingFolder(params string[] folderName)
        {
            string fullPath = System.IO.Directory.GetCurrentDirectory();
            try
            {
                for (int i = 0; i < folderName.Length; i++)
                {
                    fullPath = fullPath + "\\" + folderName[i];

                    if (!System.IO.Directory.Exists(fullPath))
                    {
                        System.IO.Directory.CreateDirectory(fullPath);
                    }
                }
            }
            catch (System.Exception ex)
            {
                ErrorHandler.handlerError(ErrorHandler.ErrorType.ERROR, ex.Message);
            }
            return fullPath;
        }
    }
}
